package vh.android.multiconnector.quiz;

import java.util.ArrayList;

import vh.android.multiconnector.library.ChannelManager;
import vh.android.multiconnector.quiz.models.Question;

public class VHQuiz {

	public Question currentQuestion;
	public ArrayList<String> receivedAnswers;
	public ChannelManager chanelManager;

	public VHQuiz(ChannelManager chanelManager) {
		super();
		this.chanelManager = chanelManager;
	}

	/**
	 * create a channel and get all the Members
	 */
	public void createNewGame(String name) {
		chanelManager.joinChannel(name); 
	}

	/**
	 * Take a question from a list send it to all members of the channel
	 * (including yourself)
	 */
	public void sendRandomQuestion() {
		
		
	}

	/**
	 * Start a Thread receiving all Answers and add them to the receivedAnswers
	 * List.
	 * 
	 * Take the first element of the list, evaluate which user sent it and give
	 * him a point if it is the correct answer
	 * 
	 */
	public void receiveAnswersFromMebers() {
	}

	public boolean isCorrectAnswer(int chosenAnswer) {
		return chosenAnswer == currentQuestion.indexCorrectAnswer;
	}

	/**
	 * Send the index of the selected answer to all members of the channel
	 */
	public void sendAnswer(int index) {
	}

	public void destroyGame() {
	}
}
